﻿<UserControl x:Class="Cirrostrata.CycleList.CaliburnTest.Views.SimpleView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cl="clr-namespace:Cirrostrata.CycleList;assembly=Cirrostrata.CycleList"
    xmlns:inf="clr-namespace:Cirrostrata.CycleList.CaliburnTest.Infrastructure"
    xmlns:cal="clr-namespace:Caliburn.PresentationFramework;assembly=Caliburn.PresentationFramework"
    xmlns:model="clr-namespace:Cirrostrata.CycleList.Model;assembly=Cirrostrata.CycleList.Model"
    >
    
    <UserControl.Resources>
        <inf:EnumToResourceConverter x:Key="resConverter" />
        <model:EquipmentStatusBindingSource x:Key="equipmentStatusSource"/>
    </UserControl.Resources>
    
    <DockPanel>
        
        <DockPanel.LayoutTransform>
            <ScaleTransform ScaleX="2" ScaleY="2" />
        </DockPanel.LayoutTransform>

        <StackPanel DockPanel.Dock="Bottom">
            <TextBlock Text="{Binding Path=CurrentStatus}"/>
            <Button Content="Complex" cal:Message.Attach="Action SwitchToComplex" Width="60" HorizontalAlignment="Center" />
        </StackPanel>
        
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <ListBox 
                Grid.Column="0" 
                ItemsSource="{StaticResource equipmentStatusSource}" 
                SelectedItem="{Binding Path=CurrentStatus, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock>
                            <Image Source="{Binding Converter={StaticResource resConverter}}" Width="12" Height="12" /> 
                            <TextBlock Text="{Binding}"/>
                        </TextBlock>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            
            <cl:CycleList 
                Grid.Column="1" 
                ItemsSource="{StaticResource equipmentStatusSource}" 
                SelectedItem="{Binding Path=CurrentStatus, Mode=TwoWay}">
                <cl:CycleList.ItemTemplate>
                    <DataTemplate>
                        <TextBlock>
                            <Image Source="{Binding Converter={StaticResource resConverter}}" Width="12" Height="12" /> 
                            <TextBlock Text="{Binding}"/>
                        </TextBlock>
                    </DataTemplate>
                </cl:CycleList.ItemTemplate>
            </cl:CycleList>
        </Grid>
        
    </DockPanel>
    
</UserControl>
